import {Directive, TemplateRef, ViewContainerRef, Input} from '@angular/core';
import {Menu} from "../../models/menu";

/**
 * @deprecated
 */
@Directive({
  selector: '[oneAdminMenu]'
})
export class AdminMenuDirective {

  constructor(
    private templateRef:TemplateRef<any>,
    private viewContainer:ViewContainerRef
  ) { }


  @Input()
  set oneAdminMenu(menus:Array<Menu>){
    if(!!menus && menus.length > 0){
      this.viewContainer.createEmbeddedView(this.templateRef);
    }else{
      this.viewContainer.clear();
    }
  }
}
